//package gupao.concurrency.kms;
//
//import gupao.concurrency.utils.ThreadPoolService;
//import lombok.extern.slf4j.Slf4j;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.concurrent.ThreadPoolExecutor;
//import java.util.stream.IntStream;
//
//@Slf4j
//public class ConcurrentRequestValidator implements RequestValidator{
//
//    final ThreadPoolExecutor executor;
//    final int concurrency;
//
//    public ConcurrentRequestValidator(int concurrency) {
//        this.executor = ThreadPoolService.getOrCreateThreadPoolExecutor
//                                            ("validator", concurrency, concurrency);
//        this.concurrency = concurrency;
//
//    }
//
//    @Override
//    public boolean validateRequest(RequestModel request, String rf) {
//        return false;
//    }
//
//    private List<List<RequestModel>> split(){
//        List<List<RequestModel>> partitions = new ArrayList<>(concurrency);
//        IntStream.range(0,concurrency).forEach(i -> partitions.add(new ArrayList<>()));
//        //分配每个 partition 对应的 request
//        int num = 0;
//        int reqNumPerPartition = .size() / concurrency;
//        for(int idx = 0 ; idx < concurrency; idx++){
//            List<RequestModel> partitionIdx = partitions.get(idx);
//            int start = idx * reqNumPerPartition;
//            int end = start + reqNumPerPartition;
//            for(num = start; num < end; num++){
//                partitionIdx.add(requestModelList.get(num));
//            }
//        }
//        if(num < requestModelList.size()){
//            List<RequestModel> last = new ArrayList<>();
//            partitions.add(last);
//            for(int i = num; i < requestModelList.size(); i++){
//                last.add(requestModelList.get(i));
//            }
//        }
//        log.info("Request Partition Number: {}", partitions.size());
//        int total = 0;
//        for (int i = 0; i < partitions.size(); i++) {
//            log.info("Request Partition {} size: {}", i, partitions.get(i).size());
//            total += partitions.get(i).size();
//        }
//        log.info("Total Requests: {}", total);
//        return partitions;
//    }
//}
